package com.xhui.vimarket.manager.ui.composer;

import java.util.Map;
import java.util.logging.LogManager;

import org.apache.log4j.Logger;
import org.springframework.context.annotation.Scope;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.ForwardEvent;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.A;
import org.zkoss.zul.Captcha;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Div;
import org.zkoss.zul.Label;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Rows;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Vbox;
import org.zkoss.zul.Window;

import com.xhui.vimarket.common.numeric.NumbericUtil;
import com.xhui.vimarket.common.utils.springplus.ApplicationContextUtil;
import com.xhui.vimarket.sys.util.context.SessionContext;
import com.xhui.vimarket.zkplus.utils.MessageBox;
import com.xhui.vimarket.zkplus.utils.ZkUtils;

/**
 * 登录实现 .
 * @Controller("loginForward")
 */

@Scope("prototype")
@SuppressWarnings( {"unchecked", "unused" })
public class LoginForward extends GenericForwardComposer {
    
    /**
     * serialVersionUID.
     */
    private static final long serialVersionUID = 1L;
    
    /**
     * PPM登录信息常量.
     */
    private static final String   PPM_LOGIN_INTF_TAG = "PPM_LOGON";
    
    /**
     * serialVersionUID.
     */
    private static Logger     logger           = Logger.getLogger(LoginForward.class);
    /**
     * loginForm.
     */
    private Vbox              loginForm;
    /**
     * selectOrgForm.
     */
    private Vbox              selectOrgForm;
    /**
     * 用户名.
     */
    private Textbox           username;
    /**
     * 密码.
     */
    private Textbox           password;
    /**
     * organization.
     */
    private Combobox          organization;
    /**
     * cap.
     */
    private Captcha           cap;
    /**
     * checkCode.
     */
    private Textbox           checkCode;
    
    /**
     * loginDiv.
     */
    private Div               loginDiv;
    
    /**
     * teamAndSeviceDiv.
     */
    private Div               teamAndSeviceDiv;
    
    private Checkbox          popupChb;
    
    /**
     * 计费的超链接.
     */
    private A                 aHB;
    
    /**
     * 随机码内容.
     */
    char[]                    captchars        = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
    
    /**
     * .
     */
    private Textbox           inputXml;
    
    /**
     * 登录系统的rows容器.
     */
    private Rows              enterSystemRows;
    /**
     * 日志管理.
     * 2012-04-27
     */
    private LogManager        logManager       = (LogManager) ApplicationContextUtil.getBean("logManager");
    
    private Textbox           valData;
    /**
     *外系统登录入口 
     */
    private String            enterFlag;
    
    /**
     * .
     */
    private Textbox           configInputXml;
    
    /**
     * 控件载入.
     * 
     * @param comp
     *            Component
     * @throws Exception
     *             Exception
     */
    @Override
    public void doAfterCompose(final Component comp) throws Exception {/*
        super.doAfterCompose(comp);
        
        char[] captchars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
        cap.setCaptchars(captchars);
        java.awt.Font font = new java.awt.Font(null, java.awt.Font.BOLD, 32);
        cap.setFont(font);
        HttpSession sess = ZkUtils.getHttpSession();
        if (sess != null) {
            String testFlag = ZkUtils.getExecutionParameter("FLAG") + "";
            if ("1".equals(testFlag)) {
                sess.setAttribute("LRU", "1");
            }
        }
        showEnterSystemUrlConfig();
    */}
    
    /**
     * 
     * 方法功能: .
     * 
     * @author chenmq
     * 2012-8-6 chenmq 
     * @修改记录： 
     * ==============================================================<br>
     * 日期:2012-8-6 chenmq 创建方法，并实现其功能
     * ==============================================================<br>
     */
    public void onCreate() {/*
        Page page = self.getPage();
        AttrSpec as = CRMClassProvider.getAttrSpec("PageClass", "webAdress");
        if (as != null && !StrUtil.isNullOrEmpty(as.getDefaultValue())) {
            page.setTitle(page.getTitle() + as.getDefaultValue());
        }
        
    */}
    
    /**
     * 登录 .
     */
    public void onLogin() {/*
        logger.debug(this.username.getValue() + "--" + this.password.getValue());
        try {
            if (!this.checkCode.getValue().equals("Qtp")) {
                if (!this.cap.getValue().equals(this.checkCode.getValue())) {
                    Messagebox.show("对不起，您输入的验证码有误！", "提示信息", Messagebox.OK, Messagebox.ERROR,
                        new EventListener() {
                            public void onEvent(Event event) throws Exception {
                                cap.randomValue();
                                password.setValue("");
                            }
                        });
                    return;
                }
            }
            Object lru = null;
            HttpSession sess = ZkUtils.getHttpSession();
            
            if (sess != null) {
                lru = sess.getAttribute("LRU");
            }
            SessionContext.clearLoginInfo();
            if (lru != null) {
                sess.setAttribute("LRU", lru);
            }
            
            final LoginService loginService = new LoginService();
            *//**
             * 调用登录服务，返回为包含岗位和组织的二维数据
             * 数组[0]为STAFF_POSITION结构体，[1]为ORGANIZATION结构体
             *//*
            List loginList = loginService.login(this.username.getValue(), this.password.getValue(),
                "");
            LogVo logVo = new LogVo();
            LogInf logInf = new LogInf();
            //            logInf.setOperatorType("LOGIN");
            logVo.setOpType(SysMainConstants.LOG_INF_OPERATOR_TYPE_LOGIN);
            //            logInf.setOperatorId(SessionContext.getStaffId());
            logVo.setOpId(StrUtil.strnull(SessionContext.getStaffId()));
            //            logInf.setCreateDate(new java.util.Date());
            HttpServletRequest request = (HttpServletRequest) Executions.getCurrent()
                .getNativeRequest();
            //            logInf.setIpAddress(request.getRemoteAddr());
            logVo.setIp(request.getRemoteAddr());
            //            logInf.setLogDesc("登录成功");
            logVo.setContent("首页系统登录");
            //            logInf.save();
            logManager.saveLogInf(logVo);
            //            SessionContext.setLoginId(logInf.getId());
            SessionContext.setLoginId(logVo.getId());
            
            // 清除下拉框内容
            while (this.organization.getItems().size() > 0) {
                this.organization.removeItemAt(this.organization.getItems().size() - 1);
            }
            
            if (loginList == null || loginList.size() == 0) {
                Messagebox.show("对不起，未在系统中定义该员工的任职岗位信息，无法登录！", "提示信息", 0, "");
                return;
            }
            *//**
             * 登录密码为初始密码时，跳转到密码修改页面(初始密码不允许登录).
             * add by g.huangwch 2012-08-02
             *//*
            
            List<String> list = CRMClassProvider.getAttrValueList("PageClass", "initPassword");
            final String oldPwd = this.password.getValue().trim();
            if (list != null && list.size() > 0 && list.contains(this.password.getValue().trim())) {
                if (Executions.getCurrent().getDesktop().getFirstPage().getFirstRoot().hasFellow(
                    "modPwdWin")) {
                    return;
                }
                Messagebox.show("对不起，您的密码是初始密码，请先修改密码后再登录！", "提示信息", Messagebox.OK,
                    Messagebox.QUESTION, new EventListener() {
                        
                        @Override
                        public void onEvent(Event event) throws Exception {
                            // TODO Auto-generated method stub
                            Map arg = new HashMap();
                            arg.put("initialPassword", oldPwd);
                            onModPwd(arg);
                        }
                    });
                
                return;
            }
            
            SystemUserVo systemUserVo = SessionContext.getLoginInfo().getSystemUserVo();
            if (systemUserVo.getPasswordExpDate() != null) {
                String strNowDate = DateUtil.getDateTime("yyyy-MM-dd", DateUtil.getNowDate());
                String StrPasswordExpDate = DateUtil.getDateTime("yyyy-MM-dd", systemUserVo
                    .getPasswordExpDate());
                //密码还有多少天失效
                final int diffDays = DateUtil.dateDiffDays(StrPasswordExpDate, strNowDate);
                //多长时间提醒密码失效
                int expDay = NumbericUtil.nullToIntegerZero(

                    CRMClassProvider.getAttrValueByName("SystemUser", "expDateType", "expDay"))
                    .intValue();
                int expDay = 1;
                *//**
                 * 密码失效提醒
                 * add by g.huangwch 2012-08-02
                 *//*
                if (diffDays <= expDay) {
                    if (Executions.getCurrent().getDesktop().getFirstPage().getFirstRoot()
                        .hasFellow("modPwdWin")) {
                        return;
                    }
                    Messagebox.show("对不起，您的密码再过" + NumbericUtil.nullToZero(diffDays)
                        + "天就失效，请进行修改密码后再登录！", "提示信息", Messagebox.OK, Messagebox.QUESTION,
                        new EventListener() {
                            
                            @Override
                            public void onEvent(Event event) throws Exception {
                                // TODO Auto-generated method stub
                                Map arg = new HashMap();
                                arg.put("expDateType", "expDateType");
                                arg.put("initialPassword", oldPwd);
                                arg.put("diffDays", NumbericUtil.nullToIntegerZero(diffDays));
                                onModPwd(arg);
                            }
                        });
                    
                    return;
                }
            }
            
            *//**
             * 2012-04-12 刘壮飞 
             * 在下拉框中的组织，应该是去重之后的，去重的逻辑为员工、组织、岗位均一致
             * 若组织一样但是岗位不一样，也应该体现为不通的两条记录
             * 例如：一个人在一个组织中，既是营业员又是营业班长的情况
             *//*
            Map<String, Object[]> orgMaps = new HashMap();
            for (int i = 0; i < loginList.size(); i++) {
                Object[] objs = (Object[]) loginList.get(i);
                StaffPosition staffPosition = (StaffPosition) objs[0];
                Organization organization = (Organization) objs[1];
                String tempStr = ("" + staffPosition.getOrgId())
                    + (";" + staffPosition.getPositionId());
                orgMaps.put(tempStr, objs);
            }
            if (orgMaps != null && orgMaps.size() > 0) {
                Set<String> setStr = orgMaps.keySet();
                Iterator<String> iterator = setStr.iterator();
                while (iterator.hasNext()) {
                    Object[] objs = orgMaps.get(iterator.next());
                    StaffPosition staffPosition = (StaffPosition) objs[0];
                    Organization org = (Organization) objs[1];
                    String positionName = staffPosition.getPosition().getPositionName();
                    final Comboitem comboitem = new Comboitem();
                    comboitem.setValue(objs);
                    comboitem.setLabel(org.getOrgName() + "(" + positionName + ")");
                    this.organization.appendChild(comboitem);
                }
            }
            
            //            // 用Map方式去除重复的组织 modify by g.huangwch 2011-12-27
            //            Map<Long, Object[]> map = new HashMap<Long, Object[]>();
            //            for (int i = 0; i < loginList.size(); i++) {
            //                Object[] objs = (Object[]) loginList.get(i);
            //                Organization org = (Organization) objs[1];
            //                map.put(org.getOrgId(), objs);
            //            }
            //            // 用Map方式去除重复的组织 modify by g.huangwch 2011-12-27
            //            if (map != null && map.size() > 0) {
            //                Set<Long> setLong = map.keySet();
            //                Iterator<Long> iterator = setLong.iterator();
            //                while (iterator.hasNext()) {
            //                    Object[] objs = map.get(iterator.next());
            //                    Organization org = (Organization) objs[1];
            //                    final Comboitem comboitem = new Comboitem();
            //                    comboitem.setValue(objs);
            //                    comboitem.setLabel(org.getOrgName());
            //                    this.organization.appendChild(comboitem);
            //                }
            //            }            
            
            if (orgMaps.size() > 0) {
                this.organization.setSelectedIndex(0);
                // if (loginList.size() == 1) { //=1，直接跳转
                if (orgMaps.size() == 1) {
                    //屏蔽果工号只有一个团队就直接进入营业受理模块 modify by g.huangwch 2012-03-28(TTP9769)
                    // this.onGoIndex(); 
                }
                
            }
            
            this.loginDiv.setVisible(false);
            this.teamAndSeviceDiv.setVisible(true);
            
        } catch (final Exception ex) {
            try {
                ex.printStackTrace();
                MessageBox.alert(ex.getMessage());
                // Messagebox.show(ex.getMessage(), "提示信息", Messagebox.OK,
                // Messagebox.ERROR);
                cap.randomValue();
            } catch (final InterruptedException e) {
                e.printStackTrace();
            }
        }
    */}
    
    /**
     * 选择组织后，点确定 .
     * 
     * @throws Exception
     *             异常
     */
    public void onGoIndex() throws Exception {/*
        logger.debug(this.username.getValue() + "--" + this.password.getValue());
        if (this.organization.getSelectedIndex() < 0) {
            Messagebox.show("对不起，请选择组织！", "提示信息", 0, "");
            return;
        }
        final Object[] objs = (Object[]) this.organization.getSelectedItem().getValue();
        final StaffPosition staffPosition = (StaffPosition) objs[0];
        final Organization organizationPo = (Organization) objs[1];
        final OrganizationVo organizationVo = new OrganizationVo();
        PubUtil.copyProperties(organizationPo, organizationVo);
        organizationVo.setOrgId(organizationPo.getOrgId());
        //        organizationVo.setRegionCd(organizationPo.getRegionCd());
        //        organizationVo.setAreaId(organizationPo.getAreaId());
        //2012-3-29 ttp9867 linzhiqiang  修正组织的错误，按照现有逻辑，现在组织所属区域，应该是commonRegionId字段
        organizationVo.setRegionCd(organizationPo.getCommonRegionId());
        AreaCode areaCode = CommonRegion.getC3AreaCodeByCommonRegionId(organizationPo
            .getCommonRegionId());
        if (areaCode != null) {
            organizationVo.setAreaId(areaCode.getRegionId());
        } else {
            organizationVo.setAreaId(organizationPo.getCommonRegionId());
        }
        // 设置组织对应的渠道标识。
        if (organizationPo.getOrgId() != null) {
            organizationVo.setChannelId(Organization.getChannelId(organizationPo.getOrgId()));
        }
        LoginInfoVo loginInfoVo = SessionContext.getLoginInfo();
        loginInfoVo.setOrganizationVo(organizationVo);
        SessionContext.setLoginInfo(loginInfoVo);
        SessionContext.setStaffPositionId(staffPosition.getStaffPositionId());
            if (popupChb.isChecked()) {
                ClientUtil.open(PageConstants.BASE_FRAME_INDEX, "", ClientUtil.OPEN_MOLD_MAX_NOSCR);
                ClientUtil.close("null");
            } else {
                Executions.sendRedirect(PageConstants.BASE_FRAME_INDEX);
            }
        */}
    
    /**
     * 返回 .
     */
    public void onRetLoginForm() {
        SessionContext.clearLoginInfo();
        this.loginDiv.setVisible(true);
        this.teamAndSeviceDiv.setVisible(false);
    }
    
    public void onRetset() {
        username.setValue("");
        password.setValue("");
        checkCode.setValue("");
    }
    
    /**
     * 方法功能: 下载火狐安装包.
     * 
     * @author: chenmq
     * @修改记录： ==============================================================<br>
     *        日期:2011-10-20 chenmq 创建方法，并实现其功能
     *        ==============================================================<br>
     */
    public void onDownLoadFireox() throws Exception {/*
        CommDoc commDoc = CommDoc.repository().get(2436L);
        if (commDoc != null) {
            
            try {
                if (commDoc != null && commDoc.getDocName() != null) {
                    String fileName = new String(commDoc.getDocName().getBytes("GBK"), "ISO8859-1")
                        .replaceAll("/", "");
                    Filedownload.save(commDoc.getDocContent().getBinaryStream(), commDoc
                        .getDocFormat(), fileName);
                }
            } catch (Exception e) {
                e.printStackTrace();
                Messagebox.show("下载失败！", "提示信息！", 1, null);
            }
        }
    */}
    
    /**
     * 方法功能: .
     * 
     * @author: chenmq
     * @修改记录： ==============================================================<br>
     *        日期:2011-10-20 chenmq 创建方法，并实现其功能
     *        ==============================================================<br>
     */
    public void onMyMouseOver(ForwardEvent event) {
        Label label = (Label) event.getOrigin().getTarget();
        label.setStyle("color: #0055A5;");
    }
    
    /**
     * 方法功能: .
     * 
     * @author: chenmq
     * @修改记录： ==============================================================<br>
     *        日期:2011-10-20 chenmq 创建方法，并实现其功能
     *        ==============================================================<br>
     */
    public void onMyMouseOut(ForwardEvent event) {
        Label label = (Label) event.getOrigin().getTarget();
        label.setStyle("color: #9999;");
    }
    
    /**
     * 跳转到计费收费页面 .
     * 
     * @author g.huangwch 2012-1-6 g.huangwch
     * @throws InterruptedException
     */
    public void onSendToHb() throws InterruptedException {
        if (NumbericUtil.nullToLongZero(SessionContext.getLoginId()).intValue() == 0) {
            Messagebox.show("对不起，请先登录！", "提示信息", 0, "");
            return;
        }
        if (this.organization.getSelectedIndex() < 0) {
            Messagebox.show("对不起，请选择组织！", "提示信息", 0, "");
            return;
        }
        String strInputXml = getInputXml();
        StringBuffer url = new StringBuffer();
        url.append(ZkUtils.getCurrentExecution().getContextPath());
        url.append("/pub_base/out_system/hb_login.html?ocxInputXml=");
        url.append(strInputXml);
        //        AccessOutSysExt.invokeOutSystem(url.toString(), "100%", "100%", 3);
        inputXml.setValue(strInputXml);
        //         StringBuffer sb = new StringBuffer();
        //         sb.append("function SendToHbPage(){ ");
        //         sb.append(" var ua = navigator.userAgent.toLowerCase();  ");
        //         sb.append(" if(ua.indexOf('msie') >-1){");
        //         sb.append("  alert('");sb.append(strInputXml);sb.append("');");
        //         sb.append(" }         ");
        //         sb.append(" else{     ");
        //         sb.append("  alert('您的浏览器不支持');");
        //         sb.append(" }         ");
        //         sb.append("} ");
        //         sb.append(" SendToHbPage() ");
        //         Clients.evalJavaScript(sb.toString());
        Clients.evalJavaScript("SendToHbPage()");
    }
    
    /**
     * 调计费控件的输入参数 .
     * 
     * @return String
     * @author g.huangwch 2012-1-9 g.huangwch
     */
    private String getInputXml() {/*
        final Object[] objs = (Object[]) this.organization.getSelectedItem().getValue();
        final StaffPosition staffPosition = (StaffPosition) objs[0];
        String strMemberId = StrUtil.strnull(staffPosition.getStaffPositionId());
        String strPassword = MD5.encrypt(this.password.getValue());
        String strHttpUrl = CRMClassProvider.getAttrValueByName("PageClass", "ocxHBHttpUrl",
            "HBHttpUrl");
        String strDownUrl = CRMClassProvider.getAttrValueByName("PageClass", "ocxHBDownUrl",
            "HBDownUrl");
        String StrFocusLogin = "1";
        StringBuffer sb = new StringBuffer();
        //sb.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>");
        sb.append("<requestInfo>");
        sb.append("<memberId>");
        sb.append(strMemberId);
        sb.append("</memberId>");
        sb.append("<password>");
        sb.append(strPassword);
        sb.append("</password>");
        sb.append("<httpUrl>");
        sb.append(strHttpUrl);
        sb.append("</httpUrl>");
        sb.append("<downUrl>");
        sb.append(strDownUrl);
        sb.append("</downUrl>");
        sb.append("<focusLogin>");
        sb.append(StrFocusLogin);
        sb.append("</focusLogin>");
        sb.append("</requestInfo>");
        sb.append("ocxInputXml=");
        String strHBCodebase = CRMClassProvider.getAttrValueByName("PageClass", "ocxHBCodebase",
            "HBCodebase");
        sb.append(strHBCodebase);
        return sb.toString();
    */
    	return "";
    	}
    
    /**
     * 展现登录系统配置信息 .
     * 
     * @author g.huangwch 2012-3-20 g.huangwch
     */
    private void showEnterSystemUrlConfig() {/*
        List<AttrValue> attrValueList = CRMClassProvider.getAttrValues("PageClass",
            "enterSystemUrlConfig");
        if (attrValueList != null) {
            int i = 0;
            Row row = null;
            for (AttrValue attrValue : attrValueList) {
                Toolbarbutton toolbarbutton = new Toolbarbutton();
                toolbarbutton.setId("toolbarbtnId" + attrValue.getId());
                toolbarbutton.setLabel(attrValue.getAttrValueName());
                toolbarbutton.setImage("/public/images/desktop/custcenter_.png");
                toolbarbutton.setTooltiptext(attrValue.getAttrValueName());
                toolbarbutton.setOrient("horizontal");
                toolbarbutton.setAttribute("ATTRVALUE", attrValue);
                toolbarbutton.addForward(Events.ON_CLICK, self, "onOpenSystemUrl", toolbarbutton);
                if (i % 2 == 0) {
                    row = new Row();
                    this.enterSystemRows.appendChild(row);
                }
                if (row != null) {
                    row.appendChild(toolbarbutton);
                }
                i++;
            }
            
            if (i % 2 == 0) {
                row = new Row();
                this.enterSystemRows.appendChild(row);
            }
            if (row != null) {
                Toolbarbutton toolbarbutton = new Toolbarbutton();
                toolbarbutton.setId("toHbConfigToolbarbtn");
                toolbarbutton.setLabel("计费配置");
                toolbarbutton.setImage("/public/images/desktop/custcenter_.png");
                toolbarbutton.setTooltiptext("计费配置");
                toolbarbutton.setOrient("horizontal");
                toolbarbutton.addForward(Events.ON_CLICK, self, "onSendToHbConfig", toolbarbutton);
                row.appendChild(toolbarbutton);
            }
        }
    */}
    
    /**
     * 打开登录系统页面 .
     * 
     * @param event
     * @author g.huangwch 2012-3-20 g.huangwch
     * @throws InterruptedException
     */
    public void onOpenSystemUrl(ForwardEvent event) throws InterruptedException {/*
        if (this.organization.getSelectedIndex() < 0) {
            Messagebox.show("对不起，请选择组织！", "提示信息", 0, "");
            return;
        }
        Object obj = event.getData();
        AttrValue attrValue = new AttrValue();
        if (obj instanceof Toolbarbutton) {
            attrValue = (AttrValue) ((Toolbarbutton) obj).getAttribute("ATTRVALUE");
            StringBuffer url = new StringBuffer();
            url.append(attrValue.getAttrDesc());
            final Object[] objs = (Object[]) this.organization.getSelectedItem().getValue();
            final StaffPosition staffPosition = (StaffPosition) objs[0];
            String strMemberId = StrUtil.strnull(staffPosition.getStaffPositionId());
	        	String strPassword = MD5.encrypt(this.password.getValue());
	            url.append("&teamMemberId=");
	            url.append(strMemberId);
	            url.append("&p=");
	            url.append(strPassword);
	            url.append("&passwd=");
	            url.append(strPassword);
            AccessOutSysExt.invokeOutSystem(url.toString(), "100%", "100%", 4);
        }
    */}
    
    /**
     * 
     * 方法功能:跳转到计费配置页面 .
     *  .
     * @param event event
     * @throws InterruptedException InterruptedException
     * @author: huangwc
     * @修改记录： 
     * ==============================================================<br>
     * 日期:2012-7-28 huangwc 创建方法，并实现其功能
     * ==============================================================<br>
     */
    public void onSendToHbConfig(ForwardEvent event) throws InterruptedException {
        
        if (NumbericUtil.nullToLongZero(SessionContext.getLoginId()).intValue() == 0) {
            MessageBox.alert("对不起，请先登录！", "提示信息");
            return;
        }
        if (this.organization.getSelectedIndex() < 0) {
            Messagebox.show("对不起，请选择组织！", "提示信息", 0, "");
            return;
        }
        String strConfigInputXml = getConfigInputXml();
        StringBuffer url = new StringBuffer();
        url.append(ZkUtils.getCurrentExecution().getContextPath());
        url.append("/pub_base/out_system/hb_config_login.html?ocxInputXml=");
        url.append(strConfigInputXml);
        configInputXml.setValue(strConfigInputXml);
        Clients.evalJavaScript("SendToHbConfigPage()");
    }
    
    /**
     * 调计费控件的输入参数 .
     * 
     * @return String
     * @author g.huangwch 2012-1-9 g.huangwch
     */
    private String getConfigInputXml() {/*
        final Object[] objs = (Object[]) this.organization.getSelectedItem().getValue();
        final StaffPosition staffPosition = (StaffPosition) objs[0];
        String strMemberId = StrUtil.strnull(staffPosition.getStaffPositionId());
        String strPassword = MD5.encrypt(this.password.getValue());
        String strHttpUrl = CRMClassProvider.getAttrValueByName("PageClass", "ocxHBConfigHttpUrl",
            "HBConfigHttpUrl");
        String strDownUrl = CRMClassProvider.getAttrValueByName("PageClass", "ocxHBConfigDownUrl",
            "HBConfigDownUrl");
        String StrFocusLogin = "1";
        StringBuffer sb = new StringBuffer();
        sb.append("<requestInfo>");
        sb.append("<memberId>");
        sb.append(strMemberId);
        sb.append("</memberId>");
        sb.append("<password>");
        sb.append(strPassword);
        sb.append("</password>");
        sb.append("<httpUrl>");
        sb.append(strHttpUrl);
        sb.append("</httpUrl>");
        sb.append("<downUrl>");
        sb.append(strDownUrl);
        sb.append("</downUrl>");
        sb.append("<focusLogin>");
        sb.append(StrFocusLogin);
        sb.append("</focusLogin>");
        sb.append("</requestInfo>");
        sb.append("ocxInputXml=");
        String strHBCodebase = CRMClassProvider.getAttrValueByName("PageClass",
            "ocxHBConfigCodebase", "HBConfigCodebase");
        sb.append(strHBCodebase);
        return sb.toString();
    */
    	return "";
    }
    
    /**
     * 
     * 方法功能:跳转到密码修改
     *  .
     * @param arg
     * @throws Exception
     * @author: huangwc
     * @修改记录： 
     * ==============================================================<br>
     * 日期:2012-8-2 huangwc 创建方法，并实现其功能
     * ==============================================================<br>
     */
    private void onModPwd(Map arg) throws Exception {
        Window win = (Window) Executions.createComponents("/pub_base/mod_pwd.zul", self, arg);
        win.setWidth("350px");
        win.doModal();
    }
}
